﻿Imports Commander_Wars.Spieletools
Public Class Tabellenverwalter
    Shared Tabellen() As ObjektTabelle = {}
    Shared Tabelle() As String = {}
    Public Sub New()
        Array.Resize(Tabelle, 0)
        Array.Resize(Tabellen, 0)
        ObjektLadeklasse.BewegungstabellenLaden()
        ObjektLadeklasse.AngriffsartenLaden()
    End Sub
    Public Shared Function GetWert(ByVal Tabellenart As String, ByVal Beschreibung As String) As Integer
        Dim Stelle As Integer = FindElement(Tabelle, Tabellenart, True)
        If Stelle >= 0 Then
            Return Tabellen(Stelle).GetWert(Beschreibung)
        End If
        Return -1
    End Function
    Public Shared Sub setWert(ByVal Tabellenart As String, ByVal Beschreibung As String, ByVal Wert As Integer)
        Dim Stelle As Integer = FindElement(Tabelle, Tabellenart, True)
        If Stelle >= 0 Then
            Tabellen(Stelle).SetWert(Beschreibung, Wert)
        End If
    End Sub
    Public Shared Sub AddTabelle(ByVal Name As String, ByVal neuTabelle As ObjektTabelle)
        If Not Tabelle.Contains(Name) Then
            Array.Resize(Tabellen, Tabellen.Length + 1)
            Array.Resize(Tabelle, Tabelle.Length + 1)
            Tabellen(Tabellen.Length - 1) = neuTabelle
            Tabelle(Tabelle.Length - 1) = Name
        End If
    End Sub

End Class
